#include <stdio.h>
#include <string.h>
#include "ff.h"
#include "oled.h"
#include "tga_image.h"
int main()
{
    FATFS ffs;
    if (f_mount(0, &ffs) != 0) { //mount ffs work area
        printf("f_mount() failed\n");
        goto error;
    }

    struct tga_image_t *tga_image;
    tga_image_alloc(&tga_image);
    tga_image_open(tga_image, "0:ugui/celso.tga");
    tga_image_read(tga_image, oled_frame_buffer());
 
    oled_init();        //initialize ssp, oled
    oled_clear(0xFFFF); //clear to white color
    oled_set_display(0, 0, tga_image_width(tga_image), tga_image_height(tga_image));    
    oled_flush_buffer();
    tga_image_free(tga_image);
error:    
    while(1){
        sleep(1000);
    }
 
    return 0;
}
